package org.jackysoft.ztree;

import java.util.Map;

import org.jackysoft.entity.base.RootEntity;

import com.google.common.collect.Maps;

public class ZTreeNode implements RootEntity{

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 5622374687257237739L;
	private String id;
	private String key;
	private boolean checked;
	private String isParent;
	private String name;
	private boolean nocheck;
	private boolean open = false;
	private String target;
	private String href;
	private String icon;
	private boolean visiable;
	private int sort;
	private String ztype;
	private Map<String, Object> attrs = Maps.newHashMap();

	public static final ZTreeNode ofNewor(){
		return new ZTreeNode();
	}
	
	public ZTreeNode(String id, String name) {
		super();
		this.id = id;
		this.name = name;
	}
	
	public ZTreeNode(String id, String name,boolean isParent) {
		super();
		this.id = id;
		this.name = name;
		this.isParent = Boolean.toString(isParent);
	}

	public ZTreeNode() {
		super();
		// TODO Auto-generated constructor stub
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean isNocheck() {
		return nocheck;
	}

	public void setNocheck(boolean nocheck) {
		this.nocheck = nocheck;
	}

	public boolean isOpen() {
		return open;
	}

	public void setOpen(boolean open) {
		this.open = open;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public String getIsParent() {
		return isParent;
	}

	public void setIsParent(String isParent) {
		this.isParent = isParent;
	}

	public String getHref() {
		return href;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public boolean isVisiable() {
		return visiable;
	}

	public void setVisiable(boolean visiable) {
		this.visiable = visiable;
	}
	public Map<String, Object> getAttrs() {
		return attrs;
	}

	public ZTreeNode attr(String key, Object value) {
		this.attrs.put(key, value);
		return this;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getZtype() {
		return ztype;
	}

	public void setZtype(String ztype) {
		this.ztype = ztype;
	}
	

	@Override
	public void setLeaf(boolean leaf) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public boolean isLeaf() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void setSort(int sort) {
		this.sort = sort;
		
	}

	public int getSort() {
		return sort;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

}
